﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;

public partial class credit_charge : FBasePage
{
    // Fields
    public NameValueCollection _system = new NameValueCollection();

    public Maticsoft.BLL.Order orderbll = new Maticsoft.BLL.Order();
    public string paytype = "";
    public string pd_FrpId = "";
    public Maticsoft.BLL.System sysbll = new Maticsoft.BLL.System();
    public SystemConfig sysconfig = new SystemConfig();
    public Maticsoft.Model.System sysmodel = new Maticsoft.Model.System();
    public Maticsoft.BLL.UserInfo userbll = new Maticsoft.BLL.UserInfo();
    public Maticsoft.Model.UserInfo usermodel = new Maticsoft.Model.UserInfo();

    // Methods
    public void GetFee()
    {
        this.usermodel = this.userbll.Getusername(base.UserName);
        this.sysmodel = this.sysbll.GetModel(1);
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        this._system = this.sysconfig.GetSystem();
        if (!(this.Page.User.Identity.IsAuthenticated && !(this.Page.User.Identity.Name == "")))
        {
            base.Response.Redirect("/account/Login.aspx");
        }
        this.GetFee();
        if (base.Request.Form["pay"] == "确定，去付款")
        {
            if (base.Request["pd_FrpId"] != null)
            {
                this.pd_FrpId = base.Request["pd_FrpId"].ToString();
                this.paytype = "yeepay";
            }
            else if (base.Request["paytype"] != null)
            {
                this.paytype = base.Request["paytype"].ToString();
            }
            else
            {
                this.paytype = "";
            }
            if (this.paytype == "")
            {
                this.SetError("友情提示：请选择支付方式");
            }
            else
            {

                base.Response.Redirect("/order/charge.aspx?pd_FrpId=" + this.pd_FrpId + "&paytype=" + this.paytype + "&fee=" + base.Request["money"].ToString() + "&orderid=" +  Maticsoft.BLL.Order.orderid(this.usermodel.Id.ToString()));
            }
        }
    }

}